/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nine.plus.ticketcenter.matchers;

import com.nineplus.ticketcenter.webmvc.controllers.Pages;
import com.nineplus.ticketcenter.webmvc.pagination.PageWrapper;
import junit.framework.Assert;
import org.mockito.ArgumentMatcher;
import org.springframework.data.domain.Page;

/**
 *
 * @author Zuui
 */
public class PageWrapperMatcher extends ArgumentMatcher {

    private Page searchResult;

    private String pageIndex;

    public PageWrapperMatcher(Page searchResult, String pageIndex) {
        this.searchResult = searchResult;
        this.pageIndex = pageIndex;
    }

    @Override
    public boolean matches(Object argument) {

        Boolean result = true;

        if (argument instanceof PageWrapper) {
            PageWrapper pageWrapper = (PageWrapper) argument;
            if (!pageIndex.equals(pageWrapper.getUrl())) {
                result = false;
            }
        } else {
            result = false;
        }
        return result;
    }

}
